<template>
	<view class="search">
		<!-- search navbar -->
		<view class="navbar" :style="{ height: systemInfo.statusBarHeight + systemInfo.navBarHeight + 'px' }">
			<view class="navBar-content" :style="{ height: systemInfo.navBarHeight + 'px', paddingTop: systemInfo.statusBarHeight + 'px' }">
				<!-- 抖音已经自带了回退按钮 -->
				<!-- #ifdef MP-WEIXIN -->
				<view :style="{ height: systemInfo.navBarHeight + 'px' }"></view>
				<view class="back">
					<image class="back-img" src="@/static/images/icons/arrow_left.png" mode="widthFix" @click="handleBack"></image>
				</view>
				<!-- #endif -->

				<view class="title">
					<view class="search-form">
						<input type="text" v-model="searchVal" placeholder="搜剧名/主角名" placeholder-style="color: #C3C3C3" :inputBorder="false" @confirm="handleSearch" />
					</view>
				</view>
			</view>
		</view>

		<!-- search list -->
		<!-- 		<scroll-view class="cards-wrapper" scroll-y enable-back-to-top>
			<view class="search-list">
				<block v-for="(item, index) in searchData" :key="index">
					<video-card :card-detail="item" isOnlyPause />
				</block>
			</view>
		</scroll-view> -->
	</view>
</template>

<script setup>
	import useCommonStore from '@/stores/common/common.js';
	import { storeToRefs } from 'pinia';
	import { onMounted, ref } from 'vue';

	// - store
	const commonStore = useCommonStore();
	const { systemInfo } = storeToRefs(commonStore);

	// - data
	const searchVal = ref('');

	// - methods
	const handleBack = () => {
		uni.navigateBack();
	};
	const handleSearch = () => {
		console.log(searchVal.value);
	};

	// - lifecycle
</script>

<style lang="scss">
	.search {
		.navbar {
			.navBar-content {
				position: fixed;
				top: 0;
				left: 0;
				z-index: 98;
				display: flex;
				flex-direction: row;
				align-items: center;
				width: 100%;
				font-size: 36rpx;
				font-weight: 500;
				color: #121212;

				.back {
					margin-left: 30rpx;

					.back-img {
						width: 20rpx;
					}
				}
				.title {
					width: 100%;
					height: 100%;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					box-sizing: border-box;
					padding: 0 200rpx 0 30rpx;

					/* #ifdef MP-TOUTIAO */
					padding: 0 0 0 100rpx;
					/* #endif */

					.search-form {
						position: relative;
						height: 80%;
						/* #ifdef MP-TOUTIAO */
						height: 70%;
						/* #endif */

						width: 100%;
						font-size: 26rpx;

						/* #ifdef MP-TOUTIAO */
						width: 55%;
						/* #endif */

						border-radius: 40rpx;
						background: #ebebeb;

						input {
							height: 100%;
							padding: 0 80rpx 0 40rpx;
						}

						.search-form-icon {
							position: absolute;
							right: 36rpx;
							top: 50%;
							transform: translateY(-50%);
							width: 36rpx;
						}
					}
				}
			}
		}

		.search-list {
			width: 100%;
			overflow-y: auto;
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			grid-column-gap: 18rpx;
			grid-row-gap: 22rpx;
			box-sizing: border-box;
			margin-top: 32rpx;
			padding-bottom: 100rpx;
		}
	}
</style>
